package cn.bytecollege.admin.dao;

import cn.bytecollege.common.dao.BaseDao;
import cn.bytecollege.common.entity.Merchant;
import cn.bytecollege.common.entity.User;

import javax.servlet.http.HttpServlet;
import java.util.List;

public class MerchantDao extends BaseDao <Merchant,Integer> {

    /**
     * 分页查询商家信息
     * @param pageIndex
     * @param pageSize
     * @return
     */
   public List<Merchant> findMerchantByPage(int pageIndex, int pageSize) {
       String sql= "SELECT MERCHANT_ID,MERCHANT_NAME,MERCHANT_PARTICULARS FROM MERCHANT LIMIT ?,?";
       int index = (pageIndex-1)*pageSize;
       return helper.executeQuery(sql, Merchant.class,index,pageSize);
   }
    /**
     * 查询商家总数
      * @return
     */
    public int count(){
        String sql = "SELECT COUNT(*) FROM MERCHANT";
        return helper.executeScale(sql);
    }

}
